package top.jacktgq.logisticControl

/**
 @Author CandyWall
 @Date 2021/4/27--1:10
 @Description groovy中的for循环
 */
// 对范围的for循环
def sum = 0

for (i in 0..9) {
    sum += i
}
println sum

sum = 0
// 对list的循环
for (i in [1, 2, 3, 4, 5, 6, 7, 8, 9]) {
    sum += i
}
println sum

// 对map的循环
for (i in ['zhangsan': 18, 'lisi': 20, 'wangwu': 16]) {
    println "姓名：${i.key}，年龄：${i.value}"
}
